package com.eclink.asset.help.controller;

import com.eclink.asset.help.domain.dao.Help;
import com.eclink.asset.help.service.HelpService;
import com.ruoyi.common.core.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 帮助文档
 * @author chenshixian
 *
 */
@Api(tags="帮助文档接口")
@RestController
@RequestMapping("/help")
public class HelpController extends BaseController {

    @Resource
    private HelpService service;

    @ApiOperation("查询")
    @GetMapping("/list")
    public ResponseEntity<List<Help>> list() {
        List<Help> list = service.selectList();
        return ResponseEntity.ok(list);
    }

    @ApiOperation("新增")
    @PostMapping("add")
    public ResponseEntity<Integer> add(@RequestBody Help entity) {
        return ResponseEntity.ok(service.insert(entity));
    }

    @ApiOperation("修改")
    @PutMapping("update")
    public ResponseEntity<Integer> edit(@RequestBody Help entity) {
        return ResponseEntity.ok(service.update(entity));
    }

    @ApiOperation("修改内容")
    @PutMapping("updateContent")
    public ResponseEntity<Integer> updateContent(@RequestBody Help entity) {
        return ResponseEntity.ok(service.updateContent(entity));
    }

    @ApiOperation("删除")
	@DeleteMapping("/{ids}")
    public ResponseEntity<Integer> remove(@PathVariable Long[] ids) {
        service.deleteByIds(ids);
        return ResponseEntity.ok(1);
    }


}
